#include "tests_pch.h"

#include <maths/trigo.h>

SUITE( trigo )
{
	TEST( sinFast )
	{
		const float fEpsilon = 0.01f;
		CHECK( black::sinFast( -black::F_PI ) - ::sin( -black::F_PI ) < fEpsilon );
		CHECK( black::sinFast( black::F_PI ) - ::sin( black::F_PI ) < fEpsilon );
		CHECK( black::sinFast( -black::F_PI_2 ) - ::sin( -black::F_PI_2 ) < fEpsilon );
		CHECK( black::sinFast( black::F_PI_2 ) - ::sin( black::F_PI_2 ) < fEpsilon );
		CHECK( black::sinFast( black::F_3_PI_2 ) - ::sin( black::F_3_PI_2 ) < fEpsilon );
		CHECK( black::sinFast( -black::F_3_PI_2 ) - ::sin( -black::F_3_PI_2 ) < fEpsilon );
		CHECK( black::sinFast( 0.34f ) - ::sin( 0.34f ) < fEpsilon );
		CHECK( black::sinFast( -black::F_2_PI ) - ::sin( -black::F_2_PI ) < fEpsilon );
		CHECK( black::sinFast( black::F_2_PI ) - ::sin( black::F_2_PI ) < fEpsilon );
	}

	TEST( cosFast )
	{
		const float fEpsilon = 0.01f;
		CHECK( black::cosFast( -black::F_PI ) - ::cos( -black::F_PI ) < fEpsilon );
		CHECK( black::cosFast( black::F_PI ) - ::cos( black::F_PI ) < fEpsilon );
		CHECK( black::cosFast( -black::F_PI_2 ) - ::cos( -black::F_PI_2 ) < fEpsilon );
		CHECK( black::cosFast( black::F_PI_2 ) - ::cos( black::F_PI_2 ) < fEpsilon );
		CHECK( black::cosFast( black::F_3_PI_2 ) - ::cos( black::F_3_PI_2 ) < fEpsilon );
		CHECK( black::cosFast( -black::F_3_PI_2 ) - ::cos( -black::F_3_PI_2 ) < fEpsilon );
		CHECK( black::cosFast( 0.34f ) - ::cos( 0.34f ) < fEpsilon );
		CHECK( black::cosFast( -black::F_2_PI ) - ::cos( -black::F_2_PI ) < fEpsilon );
		CHECK( black::cosFast( black::F_2_PI ) - ::cos( black::F_2_PI ) < fEpsilon );
	}
}
